
using QFramework;
using UnityEngine;
using System.Collections.Generic;

namespace HareGame
{
    [MonoSingletonPath("GameEntry/DataManager")]
    public partial class DataManager : MonoBehaviour, ISingleton
        {
            /// <summary>
            /// 初始化
            /// </summary>
            public void OnSingletonInit()
            {
      InitMyIAPData();
InitTaskData();

            }

            /// <summary>
            /// 定义单例
            /// </summary>
            public static DataManager Instance
            {
                get { return MonoSingletonProperty<DataManager>.Instance; }
            }


            public T GetData<T>(string ID, List<T> Datas) where T : BaseData
            {
                T data = null;
                foreach (var v in Datas)
                {
                    if (v.ID == ID)
                    {
                        data = v;
                        break;
                    }
                }

                if (data == null)
                {
                    LogKit.W("找不到ID为<color=red>" + ID + "</color>的" + typeof(T).Name + "数据");
                }

                return data;
            }
        }
    }
